package com.lijinjiang.graphics;

import com.lijinjiang.constant.Colors;

import javax.swing.*;
import java.awt.*;

/**
 * @Description 确认图标
 * @Author lijinjiang
 * @Date 2024-12-30 10:52
 */
public class JConfirmIcon implements Icon {
    private int width;
    private int height;

    public JConfirmIcon(int width, int height) {
        setDimension(width, height);
    }

    public void setDimension(int width, int height) {
        this.width = width;
        this.height = height;
    }

    @Override
    public void paintIcon(Component c, Graphics g, int x, int y) {
        Graphics2D g2D = (Graphics2D) g;
        g2D.setStroke(new BasicStroke(2));//设置粗细

        // 设置颜色
        g2D.setColor(Colors.FG_TOP_BUTTON);

        // 绘制勾形
        int[] xPoints = {x, x + 3, x + 8};  // X坐标
        int[] yPoints = {y + 3, y + 7, y - 1}; // Y坐标
        g2D.drawPolyline(xPoints, yPoints, xPoints.length);
    }

    @Override
    public int getIconWidth() {
        return width;
    }

    @Override
    public int getIconHeight() {
        return height;
    }
}
